A user might expect onlyencryptcreds=yes to do some useful encryption of
the creds despite using encryption=shared. Prevent them from thinking
they have somehow secured the creds in their repository in that case.
Also reject onlyencryptcreds=yes encryption=none in case the user
somehow thinks there is creds-only encryption going on in that case.
Sponsored-by: Graham Spencer
encryptionSetup :: SetupStage -> RemoteConfig -> RemoteGitConfig -> Annex (RemoteConfig, EncryptionIsSetup)
encryptionSetup setupstage c gc = do
pc <- either giveup return $ parseEncryptionConfig c
+ when (onlyEncryptCreds pc && encryption == Right SharedEncryption) $
+ giveup "There is no security benefit to using onlyencryptcreds=yes with encryption=shared"
+ when (onlyEncryptCreds pc && encryption == Right NoneEncryption) $
+ giveup "There is no security benefit to using onlyencryptcreds=yes with encryption=none"
checkallowedchange pc
gpgcmd <- gpgCmd <$> Annex.getGitConfig
maybe (genCipher pc gpgcmd) (updateCipher pc gpgcmd) (extractCipher pc)